//
// AlphaVersionMessageComponent.cs
//
// Copyright (C) 2008 Lukas Lipka <lukaslipka@gmail.com>
//

using System;

using Dashboard.Util;

namespace Dashboard.Engine
{
	class AlphaVersionMessageComponent : IComponent
	{
		private const bool enabled = true;

		public AlphaVersionMessageComponent () { }

		public void Initialize ()
		{
			if (!enabled)
				return;

			Dashboard.Engine.Engine.MessageBroker.Subscribe ("/event/ui/initialized", OnEngineInitialized);
		}

		public void Dispose ()
		{
		}

		private void OnEngineInitialized (Message m)
		{
			PushAlphaVersionMessage ();
		}

		private void PushAlphaVersionMessage ()
		{
			NotificationMessage m = new NotificationMessage ();
			m.Title = "Dashboard " + ConfigureDefines.Version;
			m.Text = "Welcome to the first preview version of Dashboard. Keep in " +
				"mind that this version is still under heavy development and " +
				"may not work and behave as expected. However, please do report " +
				"any difficulties or bugs that you experience while using it.";

			Dashboard.Engine.Engine.MessageBroker.Send (m);
		}

		public string Name {
			get { return "Alpha Version Message"; }
		}

		public string Description {
			get { return "Displays a notification message about the version of this software."; }
		}
	}
}